package fun

import (
	"fmt"
)

//=======================================================
//callback
func log(title string, getMsg func() string) {
	//如果开启日志记录,则记录日志
	if true {
		fmt.Println(title, ":", getMsg())
	}
}

//---------调用--------------
func run() int {
	count := 0

	msg := func() string {
		count++
		return "您没有即使提醒我,已触犯法律"
	}

	log("error", msg)
	log("warring", msg)
	log("info", msg)

	return count
}
